import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FlowableVO, FlowableForm, FlowableQuery } from '@/api/basic/flowable/types';
import Qs from 'qs';

/**
 * 查询请假申请列表
 * @param query
 * @returns {*}
 */

export const listFlowable = (query?: FlowableQuery): AxiosPromise<FlowableVO[]> => {
  return request({
    url: '/basic/flowable/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询请假申请详细
 * @param id
 */
export const getFlowable = (id: string | number): AxiosPromise<FlowableVO> => {
  return request({
    url: '/basic/flowable/' + id,
    method: 'get'
  });
};

/**
 * 新增请假申请
 * @param data
 */
export const addFlowable = (data: FlowableForm) => {
  return request({
    url: '/basic/flowable',
    method: 'post',
    data: data
  });
};

/**
 * 修改请假申请
 * @param data
 */
export const updateFlowable = (data: FlowableForm) => {
  return request({
    url: '/basic/flowable',
    method: 'put',
    data: data
  });
};

/**
 * 删除请假申请
 * @param id
 */
export const delFlowable = (id: string | number | Array<string | number>) => {
  return request({
    url: '/basic/flowable/' + id,
    method: 'delete'
  });
};

// 消息中心列表
export const queryDeptMsg = (data: any) => {
  return request({
    url: "/basic/myCenter/queryDeptMsg",
    method: 'POST',
    data
  });
};

// 阅读消息
export const readList = (data: any) => {
  return request({
    url: "/basic/myCenter/readList",
    method: "post",
    data
  });
};

// 删除消息
export const deleteList = (data: any) => {
  return request({
    url: "/basic/myCenter/deleteList",
    method: "post",
    data
  });
};

// 消息通知数量
export const queryDeptCount = (data: any) => {
  return request({
    url: "/basic/myCenter/queryDeptCount",
    method: "post",
    data
  });
};


// 代办消息已读
export const readHandle = (data: any) => {
  return request({
    url: "/basic/myCenter/readHandle",
    method: "get",
    params: data
  });
};
